Skip to content

Add AI skills for rebase rules automation#681

Open
RomanNikitenko wants to merge 2 commits into
che-incubator:mainfrom
RomanNikitenko:add-validate-rebase-rules-skill
Open

Add AI skills for rebase rules automation#681
RomanNikitenko wants to merge 2 commits into
che-incubator:mainfrom
RomanNikitenko:add-validate-rebase-rules-skill

Conversation

@RomanNikitenko

@RomanNikitenko RomanNikitenko commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

Adds a set of AI skills (for Claude / Cursor) that automate the upstream rebase rules lifecycle:

  • validate-rebase-rules — checks .rebase/ rules against current upstream VS Code; generates a validation report with stale from/by values, redundant add/override pins, and uncovered Che-specific changes
  • fix-rebase-rules — reads the validation report and auto-repairs ERROR-level replace rule issues (stale snippets, encoding problems, missing rules)
  • test-rebase-rules — end-to-end testing: runs actual rebase.sh handlers against upstream content and diffs the result against the expected che-code state. Includes run-all-tests.sh and test-rebase-handler.sh scripts
  • dependency-rebase-rules — shared guidelines for auditing dependency version pins in .rebase/add/ and .rebase/override/ (CVE pins, EOVERRIDE conflicts, lock file stability)
  • rebase — orchestrates the full upstream rebase process: version update → pre-rebase analysis → dependency audit → rule validation/fix/test → rebase.sh execution → build verification → PR creation
  • add-rebase-rules (improved) — adds encoding tables (sed/perl), uniqueness checks for from values, and a completeness verification step

Also adds PREVIOUS_UPSTREAM_VERSION / CURRENT_UPSTREAM_VERSION variables to rebase.sh, used by the skills to fetch correct upstream file content.

What issues does this PR fix?

eclipse-che/che#23749

I used these skills for alignments with upstream: #646 and #692

How to test this PR?

image
  • run Claude
  • Run any skill, e.g. type validate-rebase-rules
  • a report should be generated with detected problems

Does this PR contain changes that override default upstream Code-OSS behavior?

  • the PR contains changes in the code folder (you can skip it if your changes are placed in a che extension )
  • the corresponding items were added to the CHANGELOG.md file
  • rules for automatic git rebase were added to the .rebase folder

Generated-by: Cursor AI

Summary by CodeRabbit

  • Documentation

    • Added comprehensive guidance for rebase workflow processes, including rule creation, validation, testing, and dependency management.
  • New Features

    • Introduced automated test scripts and validation tooling for rebase rules.
    • Added dependency-management guidelines for package versioning during rebases.
  • Chores

    • Updated upstream version references to release/1.108 from release/1.104.
    • Added rebase configuration and skill specifications.

@github-actions

github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Click here to review and test in web IDE: Contribute

Comment thread rebase-rules-validation.md Outdated
@RomanNikitenko RomanNikitenko force-pushed the add-validate-rebase-rules-skill branch from 60a4fe4 to 9f0c211 Compare April 8, 2026 10:02
Comment thread CLAUDE.md
Comment thread rebase.sh

@RomanNikitenko RomanNikitenko left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR depends on

@github-actions

github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

1 similar comment
@github-actions

github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

@RomanNikitenko RomanNikitenko force-pushed the add-validate-rebase-rules-skill branch from 9f0c211 to 2b4e80b Compare April 18, 2026 04:14
@github-actions

Copy link
Copy Markdown
Contributor

@tolusha

tolusha commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Hi! I'm che-ai-assistant — I help with your pull requests.

Available commands:

  • /che-ai-assistant generate-che-doc — Generate a documentation PR based on this PR's changes
  • /che-ai-assistant ok-pr-review — Run a comprehensive PR review (summary, code review, deep review, impact analysis)
  • /che-ai-assistant help — Show this help message

@tolusha

tolusha commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

⚠️ Warning: IDE/tool configuration files detected

This PR contains changes to files in directories that are typically not intended to be committed:

  • .claude/skills/validate-rebase-rules/SKILL.md

Please verify these changes are intentional.

Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
Generated-by: Cursor AI
@RomanNikitenko RomanNikitenko force-pushed the add-validate-rebase-rules-skill branch 3 times, most recently from 2b7df21 to 497029b Compare June 12, 2026 07:12
Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
Assisted-by: Cursor AI
@RomanNikitenko RomanNikitenko force-pushed the add-validate-rebase-rules-skill branch from 497029b to 78471f2 Compare June 12, 2026 07:26
@RomanNikitenko RomanNikitenko changed the title Add 'validate-rebase-rules' skill Add AI skills for rebase rules automation Jun 12, 2026
@RomanNikitenko RomanNikitenko marked this pull request as ready for review June 12, 2026 08:01
@github-actions

Copy link
Copy Markdown
Contributor

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR establishes a complete skill-based documentation system for rebasing the che-code fork onto new upstream VS Code releases. It introduces 7 skill documents defining workflow phases (preparation, execution, verification, PR creation), rule lifecycle management (creation with strict encoding/uniqueness constraints, validation against upstream semantics, and systematic repair), specialized dependency pin auditing, and end-to-end test infrastructure with handler invocation and cosmetic diff tolerance. Two supporting bash scripts implement the test runner (parsing handlers, executing per-file tests) and test harness (stubbing git operations). The core orchestration skill coordinates these subskills and specifies error handling paths for rule failures, npm conflicts, and unresolved merge conflicts. Version constants in rebase.sh are updated to reflect alignment with VS Code release/1.108.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

The changes span documentation and test infrastructure with multiple conceptual layers (workflow, validation, dependency auditing, testing) but are primarily descriptive rather than logic-dense. Two bash scripts introduce moderate complexity (handler parsing, per-file test orchestration, cosmetic diff logic); most validation/fixing logic is documented as procedural guidance rather than automated code. The heterogeneity of skill domains requires reviewing each for internal consistency and correct references to rebase.sh, upstream versions, and file paths.

Possibly related PRs

  • che-incubator/che-code#676: Introduces the original add-rebase-rules skill documentation; this PR extends and tightens its guidance with stricter validation rules and completeness verification.

Suggested reviewers

  • rgrunber
  • azatsarynnyy
  • vitaliy-guliy
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change—adding AI skills for automating rebase rules—using imperative mood and is well within the 72-character limit at 41 characters.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Rebase Rules For Upstream Changes ✅ Passed PR #681 changes only .claude/skills/* and rebase.sh (no files under code/), so the rebase-rules/CHANGELOG/routing requirements for code changes don’t apply.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

♻️ Duplicate comments (2)
.claude/skills/validate-rebase-rules/SKILL.md (1)

19-34: ⚠️ Potential issue | 🔴 Critical | 🏗️ Heavy lift

Validation will succeed against configured version, but rebase.sh won't use it (lines 19-34)

This skill correctly reads CURRENT_UPSTREAM_VERSION from rebase.sh and validates rules against it. However, due to the hardcoded version in rebase.sh line 582, the validation will pass but the actual rebase will fail or use the wrong version.

The critical fix on rebase.sh line 582 must be made before this skill's validations will be meaningful.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/skills/validate-rebase-rules/SKILL.md around lines 19 - 34, The
skill reads CURRENT_UPSTREAM_VERSION/PREVIOUS_UPSTREAM_VERSION from rebase.sh
but rebase.sh still contains a hardcoded upstream ref that overrides it; edit
rebase.sh to remove the hardcoded ref and reference the parsed variable instead
(use CURRENT_UPSTREAM_VERSION where the hardcoded upstream-code/<version> is
used), ensure any git show/fetch invocations use
upstream-code/${CURRENT_UPSTREAM_VERSION}:<path> (and similarly use
PREVIOUS_UPSTREAM_VERSION where appropriate) so the validation and actual rebase
use the same version.
.claude/skills/fix-rebase-rules/SKILL.md (1)

28-41: ⚠️ Potential issue | 🔴 Critical

Fixes will target wrong upstream version if rebase.sh line 582 is not fixed (lines 28-41)

This skill fetches upstream files at the configured CURRENT_UPSTREAM_VERSION. However, if the critical issue in rebase.sh line 582 (hardcoded version) is not fixed, the fixes generated here will be validated against the wrong upstream version during the actual rebase.

All fixes created by this skill depend on the rebase.sh fix being applied first.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/skills/fix-rebase-rules/SKILL.md around lines 28 - 41, The skill
currently fetches upstream files using CURRENT_UPSTREAM_VERSION and
PREVIOUS_UPSTREAM_VERSION extracted from rebase.sh, but if rebase.sh still
contains the hardcoded upstream version at line 582 the skill will target the
wrong release; first update rebase.sh to remove the hardcoded version at that
location so it uses the CURRENT_UPSTREAM_VERSION variable, then ensure this
skill uses those two variables (CURRENT_UPSTREAM_VERSION and
PREVIOUS_UPSTREAM_VERSION) when constructing git show invocations (the logic
referenced in the Step 1 text) so all file fetches are validated against the
intended upstream version.
🧹 Nitpick comments (1)
.claude/skills/rebase/SKILL.md (1)

103-103: ⚡ Quick win

Add language specifiers to fenced code blocks.

Lines 103, 365, and 370 contain code blocks without language identifiers. Add ```bash or ```yaml as appropriate.

Also applies to: 365-365, 370-370

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/skills/rebase/SKILL.md at line 103, Several fenced code blocks in
SKILL.md are missing language specifiers (notably the blocks around lines
referenced in the review); update those triple-backtick fences to include the
correct language identifiers (e.g., change ``` to ```bash or ```yaml as
appropriate) so syntax highlighting works for the code samples in
.claude/skills/rebase/SKILL.md (ensure you update the fences at the three
reported locations).

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.claude/skills/add-rebase-rules/SKILL.md:
- Around line 59-79: The sed encoding table in SKILL.md is inaccurate:
rebase.sh's escape_litteral() only escapes \$, \[ and \], it does not escape &,
*, " or encode newlines/tabs; update SKILL.md or the script to make them
consistent. Fix options: 1) Update the Sed encoding section in SKILL.md to list
only the characters actually escaped by escape_litteral() (show that & and * are
not escaped and that newlines/tabs must be encoded earlier), and correct the
guidance about escaping `&` in sed replacement strings (advise using `\\&` in by
values); or 2) Modify rebase.sh's escape_litteral() to also escape `&`, `*`, `"`
and perform newline/tab encoding (and ensure tests/usage of apply_changes still
work). Reference rebase.sh and the escape_litteral() function and the sed
encoding table in SKILL.md when making the change.

In @.claude/skills/test-rebase-rules/run-all-tests.sh:
- Around line 215-243: The script currently silently ignores FILTER_FILES that
don't match any entry in MAPPINGS; modify the logic around MAPPINGS and the
for-loop that iterates over "${MAPPINGS[@]}" so that you track which
FILTER_FILES were matched (e.g., maintain a MATCHED_FILTERS set/array when you
set match=true for a given filter) and after the loop check for any FILTER_FILES
that were never matched; if any exist, print a clear error including the unknown
filter paths and exit non-zero (exit 1) so typos or stale paths fail fast.
Ensure the comparison remains the exact filename match used in the IFS='|' read
for file_path and do not change existing test_file invocation or the normal
successful flow when all filters are valid.

In @.claude/skills/test-rebase-rules/test-rebase-handler.sh:
- Around line 23-25: The wrapper currently evals the rebase handlers and then
blindly executes whatever is passed as "$@", which can run arbitrary binaries;
change the script to validate that there is at least one arg, ensure the first
argument is a sourced function by using declare -F "$1", and constrain "$1" to
the expected handler-name regex (e.g., the project's handler prefix pattern)
before dispatching; if the check fails, print an error and exit non‑zero,
otherwise call the handler with "$@" (this change affects the
test-rebase-handler.sh invocation logic around the eval and the subsequent "$@"
dispatch).

In `@rebase.sh`:
- Around line 16-17: The script rebase.sh currently hardcodes the upstream ref
when resolving the commit (uses "upstream-code/release/1.108") which breaks the
contract with PREVIOUS_UPSTREAM_VERSION and CURRENT_UPSTREAM_VERSION; update the
git rev-parse invocation to use the CURRENT_UPSTREAM_VERSION variable (e.g., git
rev-parse "upstream-code/${CURRENT_UPSTREAM_VERSION}") so the script honors the
configured CURRENT_UPSTREAM_VERSION variable and the skills' expectations.

---

Duplicate comments:
In @.claude/skills/fix-rebase-rules/SKILL.md:
- Around line 28-41: The skill currently fetches upstream files using
CURRENT_UPSTREAM_VERSION and PREVIOUS_UPSTREAM_VERSION extracted from rebase.sh,
but if rebase.sh still contains the hardcoded upstream version at line 582 the
skill will target the wrong release; first update rebase.sh to remove the
hardcoded version at that location so it uses the CURRENT_UPSTREAM_VERSION
variable, then ensure this skill uses those two variables
(CURRENT_UPSTREAM_VERSION and PREVIOUS_UPSTREAM_VERSION) when constructing git
show invocations (the logic referenced in the Step 1 text) so all file fetches
are validated against the intended upstream version.

In @.claude/skills/validate-rebase-rules/SKILL.md:
- Around line 19-34: The skill reads
CURRENT_UPSTREAM_VERSION/PREVIOUS_UPSTREAM_VERSION from rebase.sh but rebase.sh
still contains a hardcoded upstream ref that overrides it; edit rebase.sh to
remove the hardcoded ref and reference the parsed variable instead (use
CURRENT_UPSTREAM_VERSION where the hardcoded upstream-code/<version> is used),
ensure any git show/fetch invocations use
upstream-code/${CURRENT_UPSTREAM_VERSION}:<path> (and similarly use
PREVIOUS_UPSTREAM_VERSION where appropriate) so the validation and actual rebase
use the same version.

---

Nitpick comments:
In @.claude/skills/rebase/SKILL.md:
- Line 103: Several fenced code blocks in SKILL.md are missing language
specifiers (notably the blocks around lines referenced in the review); update
those triple-backtick fences to include the correct language identifiers (e.g.,
change ``` to ```bash or ```yaml as appropriate) so syntax highlighting works
for the code samples in .claude/skills/rebase/SKILL.md (ensure you update the
fences at the three reported locations).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: dfc0dc6b-6ddf-4858-9467-d0c70be91856

📥 Commits

Reviewing files that changed from the base of the PR and between 7cc0b7a and 78471f2.

📒 Files selected for processing (10)
  • .claude/skills/add-rebase-rules/SKILL.md
  • .claude/skills/dependency-rebase-rules/SKILL.md
  • .claude/skills/fix-rebase-rules/SKILL.md
  • .claude/skills/rebase/SKILL.md
  • .claude/skills/rebase/rebase-config.yaml
  • .claude/skills/test-rebase-rules/SKILL.md
  • .claude/skills/test-rebase-rules/run-all-tests.sh
  • .claude/skills/test-rebase-rules/test-rebase-handler.sh
  • .claude/skills/validate-rebase-rules/SKILL.md
  • rebase.sh

Comment on lines +59 to +79
- **Ensure `from` appears exactly once in the upstream file.** Both sed and perl handlers replace **all** occurrences — if `from` matches multiple places, all will be replaced, which is almost always wrong. Extend the snippet with more surrounding context to make it unique.
- Prefer the smallest safe snippet that is unlikely to change accidentally, but large enough to be unique in the file.
- If replacement is multiline, encode using escaped newlines/tabs in JSON consistently with existing files.
- For multiline `from` snippets, start at the first non-whitespace token (avoid anchoring on leading indentation only).
- Prefer replacing the whole logical block (`if (...) { ... }`) rather than only an inner line fragment, so closing braces remain structurally correct.
- **Encode special characters correctly** for the handler used in `rebase.sh`. See the encoding tables below.

### Sed encoding (`apply_changes`)

Values go through: JSON parse → `jq -r` → `escape_litteral` → sed.

| Character in target | `from` encoding | `by` encoding |
|---------------------|----------------|---------------|
| Newline | `\\\n` | `\\\n` |
| Tab | `\\\t` | `\\\t` |
| `&` | literal | `\\&` |
| `*` | `\\*` | literal |
| `$`, `[`, `]` | literal (`escape_litteral` handles) | literal |
| `"` | `\\\"` | `\\\"` |

**Common pitfall — `&` in sed `by` values:** In sed replacement strings, `&` means "the entire matched text". Writing `&&` in a `by` value produces the matched `from` text repeated twice instead of a literal `&&`. Always escape as `\\&\\&`. This applies to any `&` in `by`, not just `&&`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify escape_litteral function matches documented sed encoding rules
# Extract the function and compare against the encoding table

grep -A 6 "^escape_litteral()" rebase.sh | head -10

Repository: che-incubator/che-code

Length of output: 196


Fix SKILL.md sed encoding table to match rebase.sh

  • rebase.sh’s escape_litteral() only escapes \$, \[, and \]; it does not escape & (sed replacement special), *, " or perform any newline/tab encoding.
  • Update the sed encoding table (including the &amp; sed-replacement guidance) to reflect the actual escaping done, or extend escape_litteral/the multiline path to match what the docs claim.
🧰 Tools
🪛 SkillSpector (2.1.1)

[error] 3: [MP3] Memory Manipulation: Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Remediation: Protect agent memory and state from modification by untrusted content. Use read-only memory for critical instructions and validate all state changes.

(Memory Poisoning (MP3))


[error] 44: [MP3] Memory Manipulation: Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Remediation: Protect agent memory and state from modification by untrusted content. Use read-only memory for critical instructions and validate all state changes.

(Memory Poisoning (MP3))


[error] 55: [MP3] Memory Manipulation: Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Remediation: Protect agent memory and state from modification by untrusted content. Use read-only memory for critical instructions and validate all state changes.

(Memory Poisoning (MP3))


[error] 97: [MP3] Memory Manipulation: Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Remediation: Protect agent memory and state from modification by untrusted content. Use read-only memory for critical instructions and validate all state changes.

(Memory Poisoning (MP3))


[error] 142: [MP3] Memory Manipulation: Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Remediation: Protect agent memory and state from modification by untrusted content. Use read-only memory for critical instructions and validate all state changes.

(Memory Poisoning (MP3))


[error] 151: [MP3] Memory Manipulation: Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Remediation: Protect agent memory and state from modification by untrusted content. Use read-only memory for critical instructions and validate all state changes.

(Memory Poisoning (MP3))

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/skills/add-rebase-rules/SKILL.md around lines 59 - 79, The sed
encoding table in SKILL.md is inaccurate: rebase.sh's escape_litteral() only
escapes \$, \[ and \], it does not escape &, *, " or encode newlines/tabs;
update SKILL.md or the script to make them consistent. Fix options: 1) Update
the Sed encoding section in SKILL.md to list only the characters actually
escaped by escape_litteral() (show that & and * are not escaped and that
newlines/tabs must be encoded earlier), and correct the guidance about escaping
`&` in sed replacement strings (advise using `\\&` in by values); or 2) Modify
rebase.sh's escape_litteral() to also escape `&`, `*`, `"` and perform
newline/tab encoding (and ensure tests/usage of apply_changes still work).
Reference rebase.sh and the escape_litteral() function and the sed encoding
table in SKILL.md when making the change.

Comment on lines +215 to +243
FILTER_FILES=("${@+"$@"}")

MAPPINGS=()
while IFS= read -r line; do
MAPPINGS+=("$line")
done < <(parse_handlers)

total=${#MAPPINGS[@]}
i=1
for mapping in "${MAPPINGS[@]}"; do
IFS='|' read -r file_path handler handler_arg <<< "$mapping"

if [ ${#FILTER_FILES[@]} -gt 0 ]; then
match=false
for filter in "${FILTER_FILES[@]}"; do
if [[ "$file_path" == "$filter" ]]; then
match=true
break
fi
done
if [ "$match" = false ]; then
continue
fi
fi

echo "[$i/$total] $file_path ($handler)..."
test_file "$file_path" "$handler" "$handler_arg"
((i++))
done

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Unknown filter paths currently produce a false-success no-op.

If a requested file is not present in MAPPINGS, the loop just skips it and the script can finish with 0 passed, 0 warnings, 0 failed, 0 skipped. That hides typos and stale examples instead of failing fast. With the current upstream dispatch in rebase.sh, this matters immediately for paths like code/src/server-main.ts, because the actual mapping is code/src/server-main.js.

Suggested fix
 FILTER_FILES=("${@+"$@"}")
 
 MAPPINGS=()
 while IFS= read -r line; do
   MAPPINGS+=("$line")
 done < <(parse_handlers)
+
+if [ ${`#FILTER_FILES`[@]} -gt 0 ]; then
+  known_files="$(printf '%s\n' "${MAPPINGS[@]}" | cut -d'|' -f1)"
+  for filter in "${FILTER_FILES[@]}"; do
+    if ! printf '%s\n' "$known_files" | grep -qxF "$filter"; then
+      echo "ERROR: No handler mapping found for $filter" >&2
+      exit 1
+    fi
+  done
+fi
 
 total=${`#MAPPINGS`[@]}
 i=1
 for mapping in "${MAPPINGS[@]}"; do
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
FILTER_FILES=("${@+"$@"}")
MAPPINGS=()
while IFS= read -r line; do
MAPPINGS+=("$line")
done < <(parse_handlers)
total=${#MAPPINGS[@]}
i=1
for mapping in "${MAPPINGS[@]}"; do
IFS='|' read -r file_path handler handler_arg <<< "$mapping"
if [ ${#FILTER_FILES[@]} -gt 0 ]; then
match=false
for filter in "${FILTER_FILES[@]}"; do
if [[ "$file_path" == "$filter" ]]; then
match=true
break
fi
done
if [ "$match" = false ]; then
continue
fi
fi
echo "[$i/$total] $file_path ($handler)..."
test_file "$file_path" "$handler" "$handler_arg"
((i++))
done
FILTER_FILES=("${@+"$@"}")
MAPPINGS=()
while IFS= read -r line; do
MAPPINGS+=("$line")
done < <(parse_handlers)
if [ ${`#FILTER_FILES`[@]} -gt 0 ]; then
known_files="$(printf '%s\n' "${MAPPINGS[@]}" | cut -d'|' -f1)"
for filter in "${FILTER_FILES[@]}"; do
if ! printf '%s\n' "$known_files" | grep -qxF "$filter"; then
echo "ERROR: No handler mapping found for $filter" >&2
exit 1
fi
done
fi
total=${`#MAPPINGS`[@]}
i=1
for mapping in "${MAPPINGS[@]}"; do
IFS='|' read -r file_path handler handler_arg <<< "$mapping"
if [ ${`#FILTER_FILES`[@]} -gt 0 ]; then
match=false
for filter in "${FILTER_FILES[@]}"; do
if [[ "$file_path" == "$filter" ]]; then
match=true
break
fi
done
if [ "$match" = false ]; then
continue
fi
fi
echo "[$i/$total] $file_path ($handler)..."
test_file "$file_path" "$handler" "$handler_arg"
((i++))
done
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/skills/test-rebase-rules/run-all-tests.sh around lines 215 - 243,
The script currently silently ignores FILTER_FILES that don't match any entry in
MAPPINGS; modify the logic around MAPPINGS and the for-loop that iterates over
"${MAPPINGS[@]}" so that you track which FILTER_FILES were matched (e.g.,
maintain a MATCHED_FILTERS set/array when you set match=true for a given filter)
and after the loop check for any FILTER_FILES that were never matched; if any
exist, print a clear error including the unknown filter paths and exit non-zero
(exit 1) so typos or stale paths fail fast. Ensure the comparison remains the
exact filename match used in the IFS='|' read for file_path and do not change
existing test_file invocation or the normal successful flow when all filters are
valid.

Comment on lines +23 to +25
eval "$(sed -n '1,/^# perform rebase/p' rebase.sh | grep -v '^set -[eu]$')"

"$@"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Restrict execution to sourced rebase handlers before invoking "$@".

This wrapper is documented as a handler runner, but today it will execute any command line it receives after the eval. In an AI-driven flow, a typo or prompt-influenced argument can run an arbitrary binary on the operator machine instead of failing fast. Validate "$1" with declare -F and restrict it to the expected handler naming pattern before dispatch.

Suggested fix
 eval "$(sed -n '1,/^# perform rebase/p' rebase.sh | grep -v '^set -[eu]$')"
 
-"$@"
+if [ "$#" -lt 1 ] || ! declare -F "$1" >/dev/null 2>&1 || [[ ! "$1" =~ ^apply_ ]]; then
+  echo "Usage: bash test-rebase-handler.sh <rebase-handler-function> [args...]" >&2
+  exit 2
+fi
+
+"$@"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/skills/test-rebase-rules/test-rebase-handler.sh around lines 23 -
25, The wrapper currently evals the rebase handlers and then blindly executes
whatever is passed as "$@", which can run arbitrary binaries; change the script
to validate that there is at least one arg, ensure the first argument is a
sourced function by using declare -F "$1", and constrain "$1" to the expected
handler-name regex (e.g., the project's handler prefix pattern) before
dispatching; if the check fails, print an error and exit non‑zero, otherwise
call the handler with "$@" (this change affects the test-rebase-handler.sh
invocation logic around the eval and the subsequent "$@" dispatch).

Comment thread rebase.sh
Comment on lines +16 to +17
PREVIOUS_UPSTREAM_VERSION="release/1.104"
CURRENT_UPSTREAM_VERSION="release/1.108"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Root cause: rebase.sh hardcodes the upstream version; skills assume it uses variables (critical — blocks PR functionality)

The PR adds PREVIOUS_UPSTREAM_VERSION and CURRENT_UPSTREAM_VERSION to rebase.sh (lines 16–17) to support skills in reading the configured version. However, rebase.sh line 582 still hardcodes git rev-parse upstream-code/release/1.108 instead of using ${CURRENT_UPSTREAM_VERSION}. This creates a critical contract failure:

  1. Add-rebase-rules, validate-rebase-rules, and fix-rebase-rules all fetch upstream files at the version stored in CURRENT_UPSTREAM_VERSION (skill docs at .claude/skills/rebase/SKILL.md#L27, etc.)
  2. rebase.sh itself always rebases to 1.108, ignoring what the skills prepared
  3. Result: Skills validate and fix rules against one version, but rebase.sh applies them to a different version, causing silent mismatches or rule failures

The past review comment already flagged this exact issue. Update line 582 in rebase.sh:

-  UPSTREAM_VERSION=$(git rev-parse upstream-code/release/1.108)
+  UPSTREAM_VERSION=$(git rev-parse "upstream-code/${CURRENT_UPSTREAM_VERSION}")

This is a blocker; without it, the rebase skill workflow will not function correctly.

🧰 Tools
🪛 Shellcheck (0.11.0)

[warning] 16-16: PREVIOUS_UPSTREAM_VERSION appears unused. Verify use (or export if used externally).

(SC2034)


[warning] 17-17: CURRENT_UPSTREAM_VERSION appears unused. Verify use (or export if used externally).

(SC2034)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@rebase.sh` around lines 16 - 17, The script rebase.sh currently hardcodes the
upstream ref when resolving the commit (uses "upstream-code/release/1.108")
which breaks the contract with PREVIOUS_UPSTREAM_VERSION and
CURRENT_UPSTREAM_VERSION; update the git rev-parse invocation to use the
CURRENT_UPSTREAM_VERSION variable (e.g., git rev-parse
"upstream-code/${CURRENT_UPSTREAM_VERSION}") so the script honors the configured
CURRENT_UPSTREAM_VERSION variable and the skills' expectations.

@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants